package com.asset.dispoal.business.mediation.service.common;

import com.asset.dispoal.business.mediation.dto.CalculateRateRequest;
import com.asset.dispoal.business.mediation.dto.CalculateRateResponse;
import com.asset.dispoal.business.mediation.service.CalculateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import tech.mhuang.pacebox.core.ddd.BaseCommand;
import tech.mhuang.pacebox.springboot.protocol.Result;

/**
 * @description:
 * @author: yf
 * @date: 2022-08-30 10:17:38
 */
@Repository
public class CalculateRateCommand implements BaseCommand<CalculateRateRequest, Result<CalculateRateResponse>> {

    @Autowired
    private CalculateService calculateService;

    @Override
    public Result<CalculateRateResponse> execute(CalculateRateRequest request) {
        CalculateRateResponse result = calculateService.getResult(request);
        return Result.ok(result);
    }
}
